package cn.wolfcode.rbac.service.impl;

import cn.wolfcode.rbac.domain.Department;
import cn.wolfcode.rbac.domain.Employee;
import cn.wolfcode.rbac.domain.SystemDictionaryItem;
import cn.wolfcode.rbac.mapper.DepartmentMapper;
import cn.wolfcode.rbac.mapper.SystemDictionaryItemMapper;
import cn.wolfcode.rbac.query.PageResult;
import cn.wolfcode.rbac.query.QueryObject;
import cn.wolfcode.rbac.query.SystemDictionaryItemQuery;
import cn.wolfcode.rbac.service.IDepartmentService;
import cn.wolfcode.rbac.service.ISystemDictionaryItemService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class SystemDictionaryItemServiceImpl implements ISystemDictionaryItemService {
    @Autowired
    private SystemDictionaryItemMapper systemDictionaryItemMapper;

    @Override
    @Transactional(readOnly = true)
    public PageInfo query(SystemDictionaryItemQuery paramQueryObject) {
        PageHelper.startPage(paramQueryObject.getCurrentPage(), paramQueryObject.getPageSize());
        List<SystemDictionaryItem> list = this.systemDictionaryItemMapper.selectForList(paramQueryObject);
        return new PageInfo(list);
    }

    @Override
    public void saveOrUpdate(SystemDictionaryItem systemDictionaryItem) {
        if (systemDictionaryItem.getId() == null) {
            this.systemDictionaryItemMapper.insert(systemDictionaryItem);
        } else {
            this.systemDictionaryItemMapper.updateByPrimaryKey(systemDictionaryItem);
        }
    }

    @Override
    public void delete(Long paramLong) {
        this.systemDictionaryItemMapper.deleteByPrimaryKey(paramLong);
    }

    @Override
    @Transactional(readOnly = true)
    public SystemDictionaryItem get(Long paramLong) {

        return this.systemDictionaryItemMapper.selectByPrimaryKey(paramLong);
    }

    @Override
    @Transactional(readOnly = true)
    public List<SystemDictionaryItem> list() {
        List<SystemDictionaryItem> systemDictionaryItems = this.systemDictionaryItemMapper.selectAll();
        return systemDictionaryItems;
    }

    @Override
    public List<SystemDictionaryItem> selectJobs() {
        return systemDictionaryItemMapper.selectJobs();
    }

    @Override
    public List<SystemDictionaryItem> selectSources() {
        return systemDictionaryItemMapper.selectSources();
    }

    @Override
    public List<SystemDictionaryItem> selectCcts() {
        return systemDictionaryItemMapper.selectCcts();
    }

    /*@Override
    public List<SystemDictionaryItem> selectByJobId(Long id) {
        return systemDictionaryItemMapper.selectByJobId(id);
    }

    @Override
    public List<SystemDictionaryItem> selectBySourceId(Long id) {
        return systemDictionaryItemMapper.selectBySourceId(id);
    }*/
}
